home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1996-12-06 | 4.0 KB | 149 lines | [TEXT/3PRM] |
- implementation module menus;
-
- import mac_types;
-
- // Initialization and Allocation
-
- InitMenus :: !Toolbox -> Toolbox;
- InitMenus t = code (t=U)(z=Z){
- instruction 0xA930
- };
-
- NewMenu :: !Int !{#Char} !Toolbox -> (!MacMenuHandle,!Toolbox);
- NewMenu menuID menuTitle t = code (menuID=R4W,menuTitle=S,t=U)(newMenuHandle=L,z=Z){
- instruction 0xA931
- };
-
- DisposeMenu :: !MacMenuHandle !Toolbox -> Toolbox;
- DisposeMenu theMenu t = code (theMenu=L,t=U)(z=Z){
- instruction 0xA932
- };
-
- // Forming the menus
-
- AppendMenu :: !MacMenuHandle !{#Char} !Toolbox -> Toolbox;
- AppendMenu theMenu data t = code (theMenu=L,data=S,t=U)(z=Z){
- instruction 0xA933
- };
-
- AddResMenu :: !MacMenuHandle !Int !Toolbox -> Toolbox;
- AddResMenu theMenu theType t = code (theMenu=L,theType=L,t=U)(z=Z){
- instruction 0xA94D
- };
-
- // Forming the Menu Bar
-
- InsertMenu :: !MacMenuHandle !Int !Toolbox -> Toolbox;
- InsertMenu theMenu beforeID t = code (theMenu=L,beforeID=W,t=U)(z=Z){
- instruction 0xA935
- };
-
- ClearMenuBar :: !Toolbox -> Toolbox;
- ClearMenuBar t = code (t=U)(z=Z){
- instruction 0xA934
- };
-
- DrawMenuBar :: !Toolbox -> Toolbox;
- DrawMenuBar t = code (t=U)(z=Z){
- instruction 0xA937
- };
-
- DeleteMenu :: !Int !Toolbox -> Toolbox;
- DeleteMenu menuID t = code (menuID=W,t=U)(z=Z){
- instruction 0xA936
- };
-
- CalcMenuSize :: !MacMenuHandle !Toolbox -> Toolbox;
- CalcMenuSize theMenu t = code (theMenu=L,t=U)(z=Z){
- instruction 0xA948
- };
-
- GetMHandle :: !Int !Toolbox -> (!MacMenuHandle,!Toolbox);
- GetMHandle menuID t = code (menuID=R4W,t=U)(menu_handle=L,z=Z){
- instruction 0xA949
- };
-
- GetMenuBar :: !Toolbox -> (!Handle,!Toolbox);
- GetMenuBar t = code (t=R4U)(menu_list=L,z=Z){
- instruction 0xA93B
- };
-
- SetMenuBar :: !Handle !Toolbox -> Toolbox;
- SetMenuBar menu_list t = code (menu_list=L,t=U)(z=Z){
- instruction 0xA93C
- };
-
- InsMenuItem :: !MacMenuHandle !{#Char} !Int !Toolbox -> Toolbox;
- InsMenuItem theMenu itemString afterItem t = code (theMenu=L,itemString=S,afterItem=W,t=U)(z=Z){
- instruction 0xA826
- };
-
- DelMenuItem :: !MacMenuHandle !Int !Toolbox -> Toolbox;
- DelMenuItem theMenu item t = code (theMenu=L,item=W,t=U)(z=Z){
- instruction 0xA952
- };
-
- // Choosing From a Menu
-
- MenuSelect :: !Int !Int !Toolbox -> (!Int,!Int,!Toolbox);
- MenuSelect h v t = code (h=R4W,v=W,t=U)(menu_ID=W,menu_item=W,z=Z){
- instruction 0xA93D
- };
-
- MenuKey :: !Int !Toolbox -> (!Int,!Int,!Toolbox);
- MenuKey char t = code (char=R4W,t=U)(menu_ID=W,menu_item=W,z=Z){
- instruction 0xA93E
- };
-
- HiliteMenu :: !Int !Toolbox -> Toolbox;
- HiliteMenu menuID t = code (menuID=W,t=U)(z=Z){
- instruction 0xA938
- };
-
- PopUpMenuSelect :: !MacMenuHandle !Int !Int !Int !Toolbox -> (!Int,!Int,!Toolbox);
- PopUpMenuSelect menu top left popUpItem t = code (menu=R4L,top=W,left=W,popUpItem=W,t=U)(menu_ID=W,menu_item=W,z=Z){
- instruction 0xA80B
- };
-
- // Controlling the Appearance of Items
-
- SetItem :: !MacMenuHandle !Int !{#Char} !Toolbox -> Toolbox;
- SetItem theMenu item itemString t = code (theMenu=L,item=W,itemString=S)(z=Z){
- instruction 0xA947
- };
-
- GetItem :: !MacMenuHandle !Int !{#Char} !Toolbox -> (!{#Char},!Toolbox);
- GetItem theMenu item s tb = (GetItem1 theMenu item s tb, NewToolbox);
-
- GetItem1 :: !MacMenuHandle !Int !{#Char} !Toolbox -> {#Char};
- GetItem1 theMenu item s t = code (theMenu=L,item=W,s=A0,t=U)(itemString=A0){
- instruction 0x2808 || move.l a0,d4
- instruction 0x42A8 0x0004 || clr.l 4(a0)
- instruction 0x4868 0x0007 || pea 7(a0)
- instruction 0xA946
- instruction 0x2044 || move.l d4,a0
- };
-
- DisableItem :: !MacMenuHandle !Int !Toolbox -> Toolbox;
- DisableItem theMenu item t = code (theMenu=L,item=W,t=U)(z=Z){
- instruction 0xa93a
- };
-
- EnableItem :: !MacMenuHandle !Int !Toolbox -> Toolbox;
- EnableItem theMenu item t = code (theMenu=L,item=W,t=U)(z=Z){
- instruction 0xa939
- };
-
- CheckItem :: !MacMenuHandle !Int !Bool !Toolbox -> Toolbox;
- CheckItem theMenu item checked t = code (theMenu=L,item=W,checked=D1,t=U)(z=Z){
- instruction 0x1F01 || move.b d1,-(sp)
- instruction 0xa945
- };
-
- // Miscellaneous Routines
-
- CountMItems :: !MacMenuHandle !Toolbox -> (!Int,!Toolbox);
- CountMItems theMenu tb = code (theMenu=R2L,tb=U)(count=W,z=Z){
- instruction 0xA950 | _CountMItems
- };
-